package com.cloudy.s3.request;

import static com.cloudy.utility.CloudyUtility.marshalTheObject;


import com.cloudy.exception.S3AccessException;
import com.cloudy.impl.S3ObjectAsString;
import com.cloudy.s3.response.Payer;
import com.cloudy.s3.response.RequestPaymentConfiguration;

public class SetRequestPayment extends S3RequestWithNoResponse{
	
	public SetRequestPayment(String bucketName, Payer payer) throws S3AccessException {
		super(bucketName, "PUT");
		super.bucket = bucketName;
		RequestPaymentConfiguration configuration = new RequestPaymentConfiguration();
		configuration.setPayer(payer);
		S3ObjectAsString obj = new S3ObjectAsString();
		String xml = marshalTheObject(configuration);
		obj.setContent(xml);
		obj.setContentType("text/plain");
		obj.setContentLength(xml.length());
		super.setS3Object(obj);
		super.subResource = "requestPayment";
		super.attributes.put("requestPayment", "");
	}
}
